
#ifndef __H_SYMPHONY_AVATAR
#define __H_SYMPHONY_AVATAR

#include <string>
#include "creature.h"
#include "socket.h"

// Administrative bits...
#define ADMIN_BIGBRO          A
#define ADMIN_BIGBRO_LOGINS   B
#define ADMIN_BIGBRO_MODES    C
#define ADMIN_BIGBRO_DEATHS   D
#define ADMIN_BIGBRO_EVENTS   E
#define ADMIN_BIGBRO_SYSTEM   F
#define ADMIN_BIGBRO_CHANGES  G
#define ADMIN_BIGBRO_RESERVED H

#define ADMIN_INVIS           I
#define ADMIN_HEAD_BUILDER    J

// "Who" flags...
#define WHO_UNDEFINED 0
#define WHO_AFK       A
#define WHO_BUSY      B
#define WHO_BORED     C
#define WHO_DUNCE     D

// Channels...
#define CHAN_OOC      A
#define CHAN_TELL     B

// Visibility...
#define SEE_NOTHING         0
#define SEE_SOMETHING       1
#define SEE_NAME            2

class Area;
class Object;
class Handler;



class Avatar: public Creature {
  private:
    // Low level/System members...
    Socket*                 _socket;
    std::string             _output;
    unsigned short          _status;
    bool                    _disconnected;

    // Game-related members...
    unsigned long           _whoFlags;
    unsigned long           _adminFlags;
    char                    _gechoColor;
    std::string             _replyTo;
    unsigned long           _channelFlags;
    Creature*               _pedit;
    Area*                   _aedit;
    Object*                 _oedit;
    Mob*                    _medit;
    std::string             _poofin;
    std::string             _poofout;

    // Avatar-specific private methods...
    void                    processOutput( const std::string& text );

  public:
    // Constructors...
    Avatar( Socket* socket = NULL );
    virtual ~Avatar( void );

    // Public accessor methods...
    void                    socket( Socket* socket )                                  { _socket = socket; }
    Socket*                 socket( void )                                            { return _socket; }
    void                    output( const std::string& output )                       { _output = output; }
    std::string             output( void ) const                                      { return _output; }
    void                    status( const unsigned short& status )                    { _status = status; }
    unsigned short          status( void )                                            { return _status; }

    // Overloads of pure virtual methods...
    virtual bool            save( void );
    virtual bool            load( void );
    virtual bool            destroy( void );

    // Overloads of virtual methods...
    virtual void            send( const std::string& message );
    virtual void            send( const char* format, ... );
    virtual void            disconnected( const bool& disconnected )                  { _disconnected = disconnected; }
    virtual bool            disconnected( void ) const                                { return _disconnected; }
    virtual void            adminFlags( const unsigned long& adminFlags )             { _adminFlags = adminFlags; }
    virtual unsigned long   adminFlags( void ) const                                  { return _adminFlags; }
    virtual void            admin( const unsigned long& flag, const bool& value )     { adminFlags( value ? (adminFlags()|flag) : (adminFlags()&(~flag)) ); }
    virtual bool            admin( const unsigned long& flag ) const                  { return ( ( adminFlags() & flag ) == flag ); }
    virtual void            gechoColor( const char& gechoColor )                      { _gechoColor = gechoColor; }
    virtual char            gechoColor( void ) const                                  { return _gechoColor; }
    virtual void            replyTo( const std::string& replyTo )                     { _replyTo = replyTo; }
    virtual std::string     replyTo( void )                                           { return _replyTo; }
    virtual void            channelFlags( const unsigned long& channelFlags )         { _channelFlags = channelFlags; }
    virtual unsigned long   channelFlags( void ) const                                { return _channelFlags; }
    virtual void            channel( const unsigned long& flag, const bool& value )   { channelFlags( value ? (channelFlags()|flag) : (channelFlags()&(~flag)) ); }
    virtual bool            channel( const unsigned long& flag ) const                { return ( ( channelFlags() & flag ) == flag ); }
    virtual void            whoFlags( const unsigned long& whoFlags )                 { _whoFlags = whoFlags; }
    virtual unsigned long   whoFlags( void ) const                                    { return _whoFlags; }
    virtual void            who( const unsigned long& flag, const bool& value )       { whoFlags( value ? (whoFlags()|flag) : (whoFlags()&(~flag)) ); }
    virtual bool            who( const unsigned long& flag ) const                    { return ( ( whoFlags() & flag ) == flag ); }
    virtual void            pedit( Creature* pedit )                                  { _pedit = pedit; }
    virtual Creature*       pedit( void )                                             { return _pedit; }
    virtual void            aedit( Area* aedit )                                      { _aedit = aedit; }
    virtual Area*           aedit( void )                                             { return _aedit; }
    virtual void            oedit( Object* oedit )                                    { _oedit = oedit; }
    virtual Object*         oedit( void )                                             { return _oedit; }
    virtual void            medit( Mob* medit )                                       { _medit = medit; }
    virtual Mob*            medit( void )                                             { return _medit; }
    virtual void            poofin( const std::string& poofin )                       { _poofin = poofin; }
    virtual const char*     poofin( void ) const                                      { return _poofin.c_str(); }
    virtual void            poofout( const std::string& poofout )                     { _poofout = poofout; }
    virtual const char*     poofout( void ) const                                     { return _poofout.c_str(); }

    // Avatar-specific public methods...
    bool                    hasInput( void );
    std::string             getInput( void );
    bool                    hasOutput( void );
    void                    flushOutput( void );
    bool                    checkPassword( const std::string& password );
    std::string             listWhoFlags( void );

    // Statics...
    static const char*    getWhoFlagName( const unsigned long& flag );
    static unsigned long  getWhoFlagType( const std::string& flag );
};



#endif // #ifndef __H_SYMPHONY_AVATAR

